package com.foreknow.demo8;

/**
 * 使用this()调用同一个类中不同的构造方法
 */
public class ThisDemo {

    public ThisDemo() {
        System.out.println("默认无参数的构造方法......");
    }

    public ThisDemo(String name) {
        this();
        System.out.println(name);
    }

    public ThisDemo(int age,String school) {
        this("fender"); //一这要放在第一行，否则报错
        System.out.println(age + "---" +school);

    }

    public static void main(String[] args) {
        ThisDemo demo = new ThisDemo(30,"neu");
    }
}
